import './socket.scss';

window.onload = function(){
    var socket = io.connect('/');
    socket.on('connect', function(){
        // document.write('连接成功！');
        // socket.send('hello world!');
        socket.emit('message', 'Hello World!');
    });

    socket.on('message', function(data){
        console.log(data);
    });

    socket.on('disconnect', function(){
        console.log('断开连接');
    });

    socket.on('reconnect', function(){
        console.log('重新连接成功');
    });

    var socket2 = io.connect('/chat');
    socket2.on('connect', function(){
        socket.emit('message', '大家好我来啦！');
    });
    socket2.on('message', function(data){
        console.log(data);
    });
}